var $;
var layer;
var table;

    layui.use(['layer', 'table'], function () {
        layer = layui.layer;
        $ = layui.jquery;
        table = layui.table;

        getTab();

        //获取课程的审核日志数据
        function getTab(){
            var Id=$("#courseId").val();
            $.post("/tea/selcourseRecord", {"id": Id}, function (res) {
                console.log(res);
                if(res.code>-1){
                    tab(res.obj);
                }else{
                    layer.msg("数据错误",{icon:2});
                }
            });
        }

        //表格
        function tab(data) {
            table.render({
                elem: '#AuditdetailsTab',
                data: data
                , title: '审核日志数据表'
                , page: true
                , limit:8
                , cols: [[
                    {field: 'implementDate',title: '审核时间',templet(da){
                            var date=settime(da.implementDate);
                            return "<p>"+date+"</p>";
                        }},
                    {field: 'implementName', title: '审核人员'},
                    {field: 'result', title: '审核结果'},
                    {field: 'details', title: '反馈详情'}
                ]]
            })
        };

        /*日期转换*/
        function settime(da){
            var date=new Date(da);
            var year=date.getFullYear();
            var month=date.getMonth()+1;
            var day=date.getDate();
            var hours=date.getHours();
            var mm=date.getMinutes();
            var s=date.getSeconds();
            return year+'-'+add(month)+'-'+add(day)+' '+add(hours)+':'+add(mm)+':'+add(s);
            //return year+'-'+month+'-'+day+' '+hours+':'+mm+':'+s;
        };
        function add(time){//给非整数添0
            return time<10?'0'+time:time;
        };
    });